<< QuantLib`

?EuropeanOption

instr = EuropeanOption[100, 0.25, PutOption];

BlackScholesModel::usage

model = BlackScholesModel[100, 0.10, 0.01, 0.15];

val = Value[instr, model]

Keyfigures[instr, model]

<< Graphics`MultipleListPlot`

samp = Table[10000*10^(x/5), {x, 0, 2*5}] // N

samp = Table[5000*i, {i, 200}]

sim = (keyf = 
              Keyfigures[instr, model, Method -> MonteCarlo, 
                Samples -> #]; 
{{#, Value}, 
                ErrorBar[ErrorEstimate]} /. keyf ) &  /@  
        samp

simlog = 
        sim /. {{x_, y_}, err_} -> {{Log[x], y}, err};

simpoint = sim /. {{x_, y_}, err_} -> {x, y};

Take[sim, 4]

sim2 = Part[sim, #] &  /@  
          Table[4*i, {i, 1, Length[sim]/4}];

Length  /@  {sim, sim2}

Plot[1/Sqrt[n], {n, 10000, 1000000}, 
      TextStyle -> {FontFamily -> "Helvetica"}, 
      PlotLabel -> "Konvergens"]

gr1 = 
      MultipleListPlot[sim2, PlotRange -> All, 
        AxesOrigin -> {0, 
            val}, 
SymbolShape -> {PlotSymbol[Box, 
              1]}]

Show[
      FullGraphics[gr1] /. (Text[1.`*^6, x___] -> Text[1000000, x]), 
      PlotRange -> All, 
      TextStyle -> {FontFamily -> "Verdana"}]

Export["mckonv.wmf", %]

Import["mckonv.eps"]

Show[%, PlotRange -> All]

gr3 = 
      ListPlot[simpoint, PlotJoined -> True, PlotRange -> All, 
        AxesOrigin -> {0, val}]

<< Statistics`DataSmoothing`

<<Statistics`DataManipulation`

ma = 
        MovingAverage[Column[simpoint, 2], 10];
ma = Table[ma[[1]], {10 - 1}] ~Join~ ma

mapoint = Transpose[{Column[simpoint, 1], ma}];

gr4 = 
      ListPlot[mapoint, PlotJoined -> True, 
        PlotRange -> All]

Show[gr3, gr4]

Show[gr2, gr1]

Plus @@ samp